{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "8f4c30c7",
   "metadata": {},
   "source": [
    "# 标量scalar，向量vector，矩阵matrix，张量tensor"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "94e60620",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bfdacbf8",
   "metadata": {},
   "source": [
    "1. 标量，物理世界的数学建模，如何量化每一个形容词：多少，大小，高低，长远，冷热，快慢，明暗，干湿。想一想生活中还有哪些形容词，有量化他们的办法吗，如果没有该怎么量化，借助什么仪器设备可以量化？ 传感器范畴？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "15326aa1",
   "metadata": {},
   "outputs": [],
   "source": [
    "scalar = 1.2"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "40882598",
   "metadata": {},
   "source": [
    "2. 向量 \n",
    "1维向量，可以对应在一条直线上的点，代码+图示\n",
    "2维向量，对应一个平面上的点，代码+图示\n",
    "3维向量，对应一个空间中的点，代码+图示\n",
    "4+维向量，没直观的描述"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d01a39b5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(3,)\n"
     ]
    }
   ],
   "source": [
    "vector = np.array([1.0,2.1,3.2],dtype=np.float)\n",
    "print(vector.shape)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fdae77d2",
   "metadata": {},
   "source": [
    "3. 矩阵\n",
    "向量的集合，一行代表一个向量，n行代表n个向量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "ac514315",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(2, 3)\n"
     ]
    }
   ],
   "source": [
    "matrix = np.array([[1,2,3],[4,5,6]]) \n",
    "print(matrix.shape)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "efee4299",
   "metadata": {},
   "source": [
    "4. 张量\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "7632b0d8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(3, 2, 3)\n"
     ]
    }
   ],
   "source": [
    "tensor = np.array([[[1,2,3],[4,5,6]],[[1,2,3],[4,5,6]],[[1,2,3],[4,5,6]]])\n",
    "print(tensor.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cd86eea2",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
